]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Don't move window when it got unmanaged during shift animation
authorSebastian Keller <skeller@gnome.org>
Sat, 25 Oct 2025 11:03:55 +0000 (13:03 +0200)
committerMarge Bot <marge-bot@gnome.org>
Tue, 28 Oct 2025 18:38:50 +0000 (18:38 +0000)
When a window with a text-entry at the bottom that had triggered the OSK
and was shifted up to avoid overlapping the OSK is closed right after
losing keyboard focus, this results in a crash. The focus loss triggers
the animation to move the window actor back into its original position,
which moves the underlying window when finished. That however will fail
when the window has been unmanaged and some of the underlying resources
have already been destroyed while the animation was playing.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8752
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3933>

js/ui/keyboard.js

index e4efb18e02463ab94a88a9d7ed4c899320f0b44c..06f92513360c63adbd3fbbccfd7770f3af953461 100644 (file)
@@ -1920,11 +1920,21 @@ export const Keyboard = GObject.registerClass({
             ? this._focusWindowStartY - Main.layoutManager.keyboardBox.height
             : this._focusWindowStartY;
 
+        let unmanaged = false;
+        const winUnmanagedId = window.connect('unmanaged', () => {
+            unmanaged = true;
+        });
+
         windowActor.ease({
             y: finalY,
             duration: KEYBOARD_ANIMATION_TIME,
             mode: Clutter.AnimationMode.EASE_OUT_QUAD,
             onStopped: () => {
+                window.disconnect(winUnmanagedId);
+
+                if (unmanaged)
+                    return;
+
                 windowActor.y = finalY;
                 this._windowSlideAnimationComplete(window, finalY);
             },